Ninja Database Lite
Using Isolated Storage
Basic Tasks > Using Isolated Storage

With Ninja Database Lite you have the choice of using Isolated Storage or File Storage.

 

Example in C#:

 

NinjaDbConfig config = new NinjaDbConfig();

config.Storage = new IsolatedStorageDatabase("MyApplication");

NinjaDb ninja = new NinjaDb(config);

Person person = new Person();

person.Name = "John";

person.PersonId = 1;

 

//Save

ninja.Save("Person1", person);

 

//Get Keys

List<string> keys = ninja.GetKeys();

 

//Load

Person personCopy = ninja.Load<Person>("Person1");

 

//Delete

ninja.Delete("Person1");

 

Example in VB.NET: 

 

Dim config As New NinjaDbConfig()

config.Storage = New IsolatedStorageDatabase("MyApplication")

Dim ninja As New NinjaDb(config)

 

Dim person As New Person()

person.Name = "John"

person.PersonId = 1

 

'Save

ninja.Save("Person1", person)

 

'Get Keys

Dim keys As List(Of String) = ninja.GetKeys()

 

'Load

Dim personCopy As Person = ninja.Load(Of Person)("Person1")

 

'Delete

ninja.Delete("Person1")